import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '人员ID',
    align:"center",
    dataIndex: 'personId'
   },
   {
    title: '名字',
    align:"center",
    dataIndex: 'personName'
   },
   {
    title: '性别',
    align:"center",
    dataIndex: 'gender'
   },
   {
    title: '出生日期',
    align:"center",
    dataIndex: 'birthday',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '证件信息个数',
    align:"center",
    dataIndex: 'identificationNum'
   },
   {
    title: '人脸图片个数',
    align:"center",
    dataIndex: 'imageNum'
   },
   {
    title: '所属部门名称',
    align:"center",
    dataIndex: 'departName'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '人员ID',
    field: 'personId',
    component: 'Input',
  },
  {
    label: '名字',
    field: 'personName',
    component: 'Input',
  },
  {
    label: '性别',
    field: 'gender',
    component: 'Input',
  },
  {
    label: '出生日期',
    field: 'birthday',
    component: 'DatePicker',
  },
  {
    label: '证件信息个数',
    field: 'identificationNum',
    component: 'Input',
  },
  {
    label: '人脸图片个数',
    field: 'imageNum',
    component: 'Input',
  },
  {
    label: '所属部门名称',
    field: 'departName',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
export const personnelRegionFormSchema: FormSchema[] = [
  {
    label: '国家',
    field: 'nation',
    component: 'Input',
  },
  {
    label: '省市',
    field: 'province',
    component: 'Input',
  },
  {
    label: '城市',
    field: 'city',
    component: 'Input',
  },
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表表格配置
export const personnelIdentificationColumns: JVxeColumn[] = [
    {
      title: '证件类型',
      key: 'type',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '证件号',
      key: 'number',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]
export const personnelImageColumns: JVxeColumn[] = [
    {
      title: '人员照片ID',
      key: 'faceId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '人员图片名称',
      key: 'name',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '图片数据的大小',
      key: 'size',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '类型',
      key: 'type',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '图片数据',
      key: 'data',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]


// 高级查询数据
export const superQuerySchema = {
  personId: {title: '人员ID',order: 0,view: 'text', type: 'string',},
  personName: {title: '名字',order: 1,view: 'text', type: 'string',},
  gender: {title: '性别',order: 2,view: 'text', type: 'string',},
  birthday: {title: '出生日期',order: 3,view: 'date', type: 'string',},
  identificationNum: {title: '证件信息个数',order: 4,view: 'text', type: 'string',},
  imageNum: {title: '人脸图片个数',order: 5,view: 'text', type: 'string',},
  departName: {title: '所属部门名称',order: 6,view: 'text', type: 'string',},
  //子表高级查询
  personnelRegion: {
    title: '人员地区',
    view: 'table',
    fields: {
        nation: {title: '国家',order: 0,view: 'text', type: 'string',},
        province: {title: '省市',order: 1,view: 'text', type: 'string',},
        city: {title: '城市',order: 2,view: 'text', type: 'string',},
    }
  },
  personnelIdentification: {
    title: '人员证件',
    view: 'table',
    fields: {
        type: {title: '证件类型',order: 0,view: 'text', type: 'string',},
        number: {title: '证件号',order: 1,view: 'text', type: 'string',},
    }
  },
  personnelImage: {
    title: '人员照片',
    view: 'table',
    fields: {
        faceId: {title: '人员照片ID',order: 0,view: 'text', type: 'string',},
        name: {title: '人员图片名称',order: 1,view: 'text', type: 'string',},
        size: {title: '图片数据的大小',order: 2,view: 'text', type: 'string',},
        type: {title: '类型',order: 3,view: 'text', type: 'string',},
        data: {title: '图片数据',order: 4,view: 'text', type: 'string',},
    }
  },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}